package com.yamaha.bikedesalon.data;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.json.JSONObject;

import android.util.Log;

public class DealerInfo {

	public String UserId;
	public String Email;
	public String Password;
	public String FirstName;
	public String LastName;
	public String FacebookUserName;
	public String ProfileImage;
	public String Status;
	public Date CreateTime;
	public Date LastLogin;
	public String Address;
	public String Sex;
	public String Phone;
	public String Country;
	public int Province;
	public Date Birthday;
	public int Active;
	public String Name;
	public String ProvinceName;

	public DealerInfo() {
	}

	public DealerInfo(JSONObject object) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		try {

			UserId = object.getString("user_id");
			Email = object.getString("email");
			Password = object.getString("password");
			FirstName = object.getString("firstname");
			LastName = object.getString("lastname");
			FacebookUserName = object.getString("fb_username");
			ProfileImage = object.getString("profile_image");
			Status = object.getString("status");
			CreateTime = new Date(object.getLong("created_time"));
			LastLogin = new Date(object.getLong("last_login"));
			Address = object.getString("address");
			Sex = object.getString("sex");
			Phone = object.getString("phone");
			Country = object.getString("country");
			Province = object.getInt("province");
			Birthday = sdf.parse(object.getString("birthday"));
			Active = object.getInt("active");
			Name = object.getString("name");
			ProvinceName = object.getString("province_name");

		} catch (Exception e) {
			Log.e("DealerInfo Error", e.getMessage(), e);
		}
	}
}
